<?php
/*
*
* workflow.RpcBase  crm内部接口 = 客户管理
*
* ----------------------------------------------
* 零起飞网络 - 专注于企业管理系统开发
* 以质量求生存，以服务谋发展，以信誉创品牌 !
* ----------------------------------------------
* @copyright	Copyright (C) 2017-2018 07FLY Network Technology Co,LTD All rights reserved.
* @license    For licensing, see LICENSE.html
* @author ：kfrs <goodkfrs@QQ.com> 574249366
* @version ：1.0
* @link ：http://www.07fly.xyz
*/

namespace app\workflow\controller\rpc;


/**
 * 工作流程对内部提供接口
 */
class RpcApi extends RpcBase
{

    /**业务提交到工作流程中
     * @return mixed
     * Author: 开发人生 goodkfrs@qq.com
     * Date: 2022/2/18 0018 10:06
     */
    public function getWorkFlowList()
    {
        $where=[];
        if(!empty($this->param['business_type'])){
            $where['business_type']=$this->param['business_type'];
        }
        $res = $this->logicWorkflow->getWorkflowList($where, 'id,name', 'sort asc', false);
        return $this->apiReturn($res);
    }

    /**
     * 业务提交到工作流程中
     * @return mixed
     * Author: 开发人生 goodkfrs@qq.com
     * Date: 2022/2/18 0018 10:06
     */
    public function workFlowBusinessAdd()
    {
        $res = $this->logicWorkflowBusiness->workflowAddInterface($this->param);
        return $this->apiReturn($res);
    }

    /**
     * 获得一条业务审批详细
     *
     * @return mixed
     * Author: 开发人生 goodkfrs@qq.com
     * Date: 2022/2/18 0018 10:06
     */
    public function getWorkflowBusinessInfo()
    {
        $where['business_id'] = $this->param['business_id'];
        $where['business_type'] = $this->param['business_type'];
        $res = $this->logicWorkflowBusiness->getWorkflowBusinessInfo($where);
        return $this->apiReturn($res);
    }

    /**
     * 获得一条审批记录详细
     *
     * @return mixed
     * Author: 开发人生 goodkfrs@qq.com
     * Date: 2022/2/18 0018 10:06
     */
    public function getWorkflowBusinessHistoryInfo()
    {
        $res = $this->logicWorkflowBusinessHistory->getWorkflowBusinessHistoryInfo(['id' => $this->param['id']]);
        return $this->apiReturn($res);
    }
}
